home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
wg_lib
/
filefrm2.frm
< prev
next >
Wrap
Text File
|
1995-09-06
|
7KB
|
262 lines
VERSION 2.00
Begin Form FileFrm2
BackColor = &H00C0C0C0&
Caption = "Faster File I/O"
ClientHeight = 3390
ClientLeft = 1260
ClientTop = 1710
ClientWidth = 7170
Height = 3795
Left = 1200
LinkMode = 1 'Source
LinkTopic = "Form1"
ScaleHeight = 3390
ScaleWidth = 7170
Top = 1365
Width = 7290
Begin Frame Frame2
BackColor = &H00C0C0C0&
Height = 2415
Left = 3750
TabIndex = 7
Top = 615
Width = 3015
Begin CommandButton Command2
Caption = "Execute"
Height = 390
Left = 930
TabIndex = 10
Top = 930
Width = 810
End
Begin OptionButton VOpt
BackColor = &H00C0C0C0&
Caption = "Read From File"
Height = 285
Index = 2
Left = 420
TabIndex = 9
Top = 525
Visible = 0 'False
Width = 1980
End
Begin OptionButton VOpt
BackColor = &H00C0C0C0&
Caption = "Write To File"
Height = 255
Index = 1
Left = 420
TabIndex = 8
Top = 195
Value = -1 'True
Width = 2025
End
Begin Label VRes
BackColor = &H00FFFFFF&
Height = 270
Left = 150
TabIndex = 12
Top = 1920
Width = 2700
End
Begin Label VMsg
Height = 255
Left = 165
TabIndex = 11
Top = 1515
Width = 2685
End
End
Begin Frame Frame1
BackColor = &H00C0C0C0&
Height = 2415
Left = 330
TabIndex = 0
Top = 615
Width = 3015
Begin CommandButton Command1
Caption = "Execute"
Height = 375
Left = 1080
TabIndex = 2
Top = 960
Width = 855
End
Begin OptionButton IOpt
BackColor = &H00C0C0C0&
Caption = "Read From File"
Height = 255
Index = 2
Left = 360
TabIndex = 5
Top = 600
Visible = 0 'False
Width = 2295
End
Begin OptionButton IOpt
BackColor = &H00C0C0C0&
Caption = "Write To File"
Height = 255
Index = 1
Left = 360
TabIndex = 4
Top = 225
Value = -1 'True
Width = 2175
End
Begin Label IRes
BackColor = &H00FFFFFF&
ForeColor = &H00000000&
Height = 255
Left = 225
TabIndex = 6
Top = 1950
Width = 2550
End
Begin Label IMSg
BackColor = &H00FFFFFF&
Height = 240
Left = 225
TabIndex = 3
Top = 1500
Width = 2535
End
End
Begin Label Label6
BackColor = &H00C0C0C0&
Caption = "Normal VB "
Height = 210
Left = 3765
TabIndex = 13
Top = 375
Width = 1830
End
Begin Label Label1
BackColor = &H00C0C0C0&
Caption = "InfoSoft I/O"
Height = 255
Left = 330
TabIndex = 1
Top = 375
Width = 1335
End
End
DefInt A-Z
Dim IFil As String
Dim VFil As String
Sub Command1_Click ()
IMsg.Caption = "Creating random file"
IRes.Caption = ""
IRes.Refresh
quan = 3500
ReDim Test(1 To quan) As TStruct
If IOpt(1).value Then
For x = 1 To quan
Test(x).i = x
Test(x).l = x
Test(x).s = String$(6, "!")
Next x
End If
IMsg.Caption = "Memory structure done. Starting timer"
IMsg.Refresh
IFil$ = "ITest.fil"
s! = Timer
If IOpt(1).value Then
IMsg.Caption = "Outputting to file"
errc = FCreat(IFil$, Fhandle)
Else
IMsg.Caption = "Reading from file"
errc = FOpen(IFil$, Fhandle)
End If
IMsg.Refresh
siz = Len(Test(1))
If IOpt(1).value Then
errc = FRecPutA(Fhandle, quan, siz, Test(1))
IOpt(2).Visible = 1
Else
errc = FRecGetA(Fhandle, quan, siz, Test(1))
End If
el! = Timer - s!
errc = FClose(Fhandle)
IRes.Caption = "Our I/O ops took " + Format$(el!) + " secs"
IMsg.Caption = "Done"
End Sub
Sub Command2_Click ()
VMsg.Caption = "Creating random file"
VRes.Caption = ""
VRes.Refresh
quan = 3500
ReDim Test(1 To quan) As TStruct
If VOpt(1).value Then
For x = 1 To quan
Test(x).i = x
Test(x).l = x
Test(x).s = String$(6, "!")
Next x
End If
VMsg.Caption = "Memory structure done. Starting timer"
VMsg.Refresh
VFil$ = "VTest.fil"
s! = Timer
If VOpt(1).value Then
VMsg.Caption = "Outputting to file"
fh = FreeFile
Open VFil$ For Random As #fh Len = Len(Test(1))
Else
VMsg.Caption = "Reading from file"
fh = FreeFile
Open VFil$ For Random As #fh Len = Len(Test(1))
End If
VMsg.Refresh
siz = Len(Test(1))
If VOpt(1).value Then
For x = 1 To quan
Put #fh, x, Test(x)
Next x
VOpt(2).Visible = 1
Else
For x = 1 To quan
Get #fh, x, Test(x)
Next x
End If
el! = Timer - s!
Close #fh
VRes.Caption = "VB I/O ops took " + Str$(el!) + " secs"
VMsg.Caption = "Done"
End Sub
Sub Form_Paint ()
ConvexFrm FileFrm2, 5
ConcaveCtl IMsg, 3
ConcaveCtl IRes, 3
ConcaveCtl VMsg, 3
ConcaveCtl VRes, 3
End Sub
Sub Form_Unload (Cancel As Integer)
If Fexists(IFil$) Then Kill IFil$
If Fexists(VFil$) Then Kill VFil$
End Sub